<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 * @ filename: defined totally fields in user that login
 * @ author: Nguyen Van Nam
 * @ license: Nam & Thien
 * @ contact: nguyennamcdt1@gmail.com || thelightsky@gmail.com
 */
/* 
 * Enable sessions 
 */ 
 
session_start(); 
 
/* 
 * Generate an anti-CSRF token if one doesn't exist 
 */ 
if ( !isset($_SESSION['token']) ) 
{ 
    $_SESSION['token'] = sha1(uniqid(mt_rand(), TRUE)); 
}
/* 
 * Include the necessary configuration info 
 */ 
include_once 'db.config.php'; 
 
/* 
 * Define constants for configuration info 
 */ 
foreach ( $C as $name => $val ) 
{ 
    define($name, $val); 
} 
 
/* 
 * Create a PDO object 
 */ 
$dsn = "mysql:host=" . DB_HOST . ";dbname=" . DB_NAME; 
$dbo = new PDO($dsn, DB_USER, DB_PASS); 
$dbo->exec("SET NAMES 'UTF8'");
/* 
 * Define the auto-load function for classes 
 */ 
function __autoload($class) 
{ 
    $filename = "../login/class.".$class.".php"; 
    if ( file_exists($filename) ) 
    { 
        include_once $filename; 
    }  else {
        echo 'file not exist';
    }
} 
?>
